package com.rtx.edi.gatway.controller;

import java.util.stream.Collectors;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.rtx.edi.gatway.handle.GatWayHandle;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@SuppressWarnings("all")
@Api(tags = {"新网关"})
@RestController
@RequestMapping("/gatway")
public class GatWayHandleController {
	
	@Autowired
	GatWayHandle gatWayHandle;

	@ApiOperation(value = "同步请求", notes = "同步请求")
	@PostMapping("/std/test")
	public String syncRequest(HttpServletRequest request) throws Exception {
		String method = request.getParameter("method");
		String body = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
		return gatWayHandle.handleRequest(body, method);
	}
}
